<template>
  <!-- 观察室工作逐日登记表 -->
  <div>
    <h1>观察室工作逐日登记表</h1>
    <h3>统计时期：{{year}} 年 {{monthName}}</h3>
    <h2>
      <span>单位名称：湖北省中医院</span>
      <span>科室名称：{{officeName}}</span>
    </h2>
    <el-table :data="tableData" stripe border style="width: 100%">
      <el-table-column prop="rq" label="日期" align="center" width></el-table-column>
      <el-table-column prop="tjm4001" label="观察室床位数" align="center" width></el-table-column>
      <el-table-column prop="tjm4002" label="原有病人数" align="center" width></el-table-column>
      <el-table-column prop="tjm4003" label="入室病人数" align="center" width></el-table-column>
      <el-table-column label="急诊原因分类" align="center" width>
        <el-table-column prop="tjm4004" label="小计" align="center" width></el-table-column>
        <el-table-column prop="tjm4005" label="回家" align="center" width></el-table-column>
        <el-table-column prop="tjm4006" label="入院" align="center" width></el-table-column>
        <el-table-column prop="tjm4007" label="死亡" align="center" width></el-table-column>
      </el-table-column>
      <el-table-column prop="tjm4008" label="留室病人数" align="center" width></el-table-column>
      <el-table-column label="危重抢救" align="center" width>
        <el-table-column prop="tjm4009" label="人数" align="center" width></el-table-column>
        <el-table-column prop="tjm4009LessTjm4007" label="成功" align="center" width></el-table-column>
      </el-table-column>
      <el-table-column prop="tjm4010" label="出室病人占床天数" align="center" width></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { watchRoomRegister } from "@/api";
import { showOkMsg, showErrorMsg } from "@/utils/index.js";

export default {
  data() {
    return {
      tableData: [],
      year: "",
      month: "",
      monthName: "",
      officeName: ""
    };
  },
  created() {
    this.getTableList();
  },
  props: ["dateList"],
  methods: {
    getTableList() {
      if (this.dateList.month) {
        watchRoomRegister({
          // kbdm: this.dateList.administrative,
          // rls: this.dateList.year + this.dateList.month
          bz: "42",
          kbdm: this.dateList.year + this.dateList.month,
          sq: ""
        }).then(res => {
          if (res.code === 0) {
            this.year = this.dateList.year;
            this.monthName = this.dateList.monthName;
            this.officeName = this.dateList.administrativeName;
            this.tableData = res.data;
            showOkMsg(res.msg);
          }
        });
      } else {
        showErrorMsg("请选择日期");
      }
    }
  }
};
</script>

<style scoped>
h1 {
  font-size: 24px;
  text-align: center;
  padding: 23px 0;
}
h3 {
  text-align: center;
  padding-bottom: 20px;
}
h2 {
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
}
</style>